package figury;

import java.util.Scanner;

public class Kwadrat implements Pole {

    private double a;
    private double pole;

    @Override
    public void pole() {
        int b;
        System.out.println("Podaj bok kwadratu");
        Scanner bok = new Scanner(System.in);
        a = bok.nextDouble();
        b = (int) a;
        pole = a * a;
        if (a % b == 0) {
            System.out.printf("Kwadrat o boku " + b + " ma pole o wartości P=%.0f", pole);
            System.out.println();
        } else {
            System.out.println("Kwadrat o boku " + a + " ma pole o wartości P=" + pole);
        }
    }

}
